<?php
	$id=$_POST['id'];
    require('sql.php');
    $json='';
    $data=array();
class user
{
	public $id;
	public $cookie;
	public $date;
	public $content;
	public $zan;
}
$sql="SELECT * FROM pinglun WHERE id='$id' order by date ASC";
$result=mysqli_query($conn,$sql);
 while($row=mysqli_fetch_array($result))
     {
       	  $user=new user();
       	  $user->id=$row['id'];
       	  $user->cookie=$row['cookie'];
       	  $user->date=$row['date'];
       	  $user->content=$row['content'];
       	  $user->zan=$row['zan'];
       	  $data[]=$user;
     }
      $json=json_encode($data);//把数据转换为json数据
     echo $json;
?>